﻿
using System;
using System.IO;
using System.Xml.Serialization;

namespace NCP.Recruiting.WebApp.Models {
    public class UserInfo {
        /// <summary>
        /// CompanyName
        /// </summary>
        public string DisplayName { get; set; }

        /// <summary>
        /// UserName
        /// </summary>
        public string FullName { get; set; }


        /// <summary>
        /// UserId
        /// </summary>
        public Guid UserId { get; set; }

        public override string ToString() {
            XmlSerializer serializer = new XmlSerializer(typeof(UserInfo));
            using (var stream = new StringWriter()) {
                serializer.Serialize(stream, this);
                return stream.ToString();
            }
        }

        public static UserInfo FromString(string userContextData) {
            XmlSerializer serializer = new XmlSerializer(typeof(UserInfo));
            using (var stream = new StringReader(userContextData)) {
                return serializer.Deserialize(stream) as UserInfo;
            }
        }
    }
}